package dao.impl;

import dao.TeacherDao;
import entity.Teacher;
import Utile.BaseDao;

import java.sql.Connection;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

public class TeacherDaoImpl implements TeacherDao {
    //查询所有
    @Override
    public List<Teacher> getTeacherList() throws Exception {


       /* connection=getConnection();
        String sql="select * from teacher";
       statement= connection.prepareStatement(sql);
       resultSet= statement.executeQuery();
        ArrayList<Teacher> list = new ArrayList<>();
        while (resultSet.next()){
            int tno = resultSet.getInt("tno");
            String tname = resultSet.getString("tname");
            String gender = resultSet.getString("gender");
            Date drithdata = resultSet.getDate("birthdate");
            Teacher teacher = new Teacher(tno,tname,gender,drithdata);
            list.add(teacher);
        }
       close(resultSet,statement,connection);
        return list;*/
        return BaseDao.doQuery(Teacher.class,"select tno,tname,gender,birthdate from teacher");
    }

    @Override
    public int addTeacher(Teacher teacher) throws Exception{


        return 0;
    }

    @Override
    public Teacher getTeacherByTno(int tno) throws Exception {
        return null;
    }


    /*
    * ·master 表注册功能
    * ·修改Tom的密码*/
}
